import request from "@/request";
import ResultEnum from "@/config/ResultEnum";

export interface FormValue {
  parentId: number | undefined;
  deptName: string | undefined;
  deptEn: string | undefined;
  leader: string | undefined;
  phone: string | undefined;
  orderNum: number | undefined;
  ancestors: string | undefined;
}

export const submit = (data: any) => {
  return new Promise((resolve: any, reject: any) => {
    request({
      url: "/dept/add",
      method: "post",
      data,
    }).then((res: any) => {
      if (res.code == ResultEnum.SUCCESS_CODE) {
        resolve(res.result);
      } else {
        reject(res.message);
      }
    });
  });
};
